//  FullCopyList by sam
//	a normal list, when passed by copy, passes a copy of the
//	List containing proxies of its items
//	This class delivers a copy of the List containing copies of the items.

#import "FullCopyList.h"


@implementation FullCopyList

- encodeRemotelyFor:(NXConnection *)connection freeAfterEncoding:(BOOL *)flagp isBycopy:(BOOL)isBycopy
{
	if (isBycopy) return self;
	return [super encodeRemotelyFor:connection 
		freeAfterEncoding:flagp isBycopy:isBycopy];
}

- encodeUsing:(id <NXEncoding>)portal
{
	int	n = [self count];
	int counter;
	
	[portal encodeData:&n ofType:"i"];
	for (counter = 0; counter < n; ++counter) {
		id	anObject = [self objectAt:counter];
		[portal encodeObjectBycopy:anObject];
	}
	return self;
}

- decodeUsing:(id <NXDecoding>)portal
{
	int counter, n;
	[portal decodeData:&n ofType:"i"];
	[self initCount:n];
	for (counter = 0; counter < n; ++counter) {
		id anObject = [portal decodeObject];
		[self addObject:anObject];
	}
	return self;
}
@end


